home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue33 / delcom / AxDesktop_TLB.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-04-11  |  4.7 KB  |  173 lines

  1. unit AxDesktop_TLB;
  2.  
  3. { This file contains pascal declarations imported from a type library.
  4.   This file will be written during each import or refresh of the type
  5.   library editor.  Changes to this file will be discarded during the
  6.   refresh process. }
  7.  
  8. { AxDesktop Library }
  9. { Version 1.0 }
  10.  
  11. interface
  12.  
  13. uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
  14.  
  15. const
  16.   LIBID_AxDesktop: TGUID = '{1E5161AB-D086-11D1-8CDD-E61AF2D4AD0C}';
  17.  
  18. const
  19.  
  20. { Component class GUIDs }
  21.   Class_XDesktop: TGUID = '{1E5161AE-D086-11D1-8CDD-E61AF2D4AD0C}';
  22.  
  23. type
  24.  
  25. { Forward declarations: Interfaces }
  26.   IXDesktop = interface;
  27.   IXDesktopDisp = dispinterface;
  28.   IXDesktopEvents = dispinterface;
  29.  
  30. { Forward declarations: CoClasses }
  31.   XDesktop = IXDesktop;
  32.  
  33. { Dispatch interface for XDesktop Control }
  34.  
  35.   IXDesktop = interface(IDispatch)
  36.     ['{1E5161AC-D086-11D1-8CDD-E61AF2D4AD0C}']
  37.     function Get_Font: Font; safecall;
  38.     procedure Set_Font(const Value: Font); safecall;
  39.     function Get_ItemCount: Integer; safecall;
  40.     procedure Set_ItemCount(Value: Integer); safecall;
  41.     function Get_TextColor: TColor; safecall;
  42.     procedure Set_TextColor(Value: TColor); safecall;
  43.     function Get_TextBackgroundColor: TColor; safecall;
  44.     procedure Set_TextBackgroundColor(Value: TColor); safecall;
  45.     procedure AboutBox; safecall;
  46.     function Get_Visible: WordBool; safecall;
  47.     procedure Set_Visible(Value: WordBool); safecall;
  48.     property Font: Font read Get_Font write Set_Font;
  49.     property ItemCount: Integer read Get_ItemCount write Set_ItemCount;
  50.     property TextColor: TColor read Get_TextColor write Set_TextColor;
  51.     property TextBackgroundColor: TColor read Get_TextBackgroundColor write Set_TextBackgroundColor;
  52.     property Visible: WordBool read Get_Visible write Set_Visible;
  53.   end;
  54.  
  55. { DispInterface declaration for Dual Interface IXDesktop }
  56.  
  57.   IXDesktopDisp = dispinterface
  58.     ['{1E5161AC-D086-11D1-8CDD-E61AF2D4AD0C}']
  59.     property Font: Font dispid 1;
  60.     property ItemCount: Integer dispid 2;
  61.     property TextColor: TColor dispid 3;
  62.     property TextBackgroundColor: TColor dispid 4;
  63.     procedure AboutBox; dispid -552;
  64.     property Visible: WordBool dispid 5;
  65.   end;
  66.  
  67. { Events interface for XDesktop Control }
  68.  
  69.   IXDesktopEvents = dispinterface
  70.     ['{1E5161AD-D086-11D1-8CDD-E61AF2D4AD0C}']
  71.   end;
  72.  
  73. { XDesktopControl }
  74.  
  75.   TXDesktop = class(TOleControl)
  76.   private
  77.     FIntf: IXDesktop;
  78.     function GetControlInterface: IXDesktop;
  79.   protected
  80.     procedure CreateControl;
  81.     procedure InitControlData; override;
  82.     function GetTOleEnumProp(Index: Integer): TOleEnum;
  83.     procedure SetTOleEnumProp(Index: Integer; Value: TOleEnum);
  84.   public
  85.     procedure AboutBox;
  86.     property ControlInterface: IXDesktop read GetControlInterface;
  87.   published
  88.     property TabStop;
  89.     property Align;
  90.     property DragCursor;
  91.     property DragMode;
  92.     property ParentShowHint;
  93.     property PopupMenu;
  94.     property ShowHint;
  95.     property TabOrder;
  96.     property OnDragDrop;
  97.     property OnDragOver;
  98.     property OnEndDrag;
  99.     property OnEnter;
  100.     property OnExit;
  101.     property OnStartDrag;
  102.     property Font: TFont index 1 read GetTFontProp write SetTFontProp stored False;
  103.     property ItemCount: Integer index 2 read GetIntegerProp write SetIntegerProp stored False;
  104.     property TextColor: TColor index 3 read GetTColorProp write SetTColorProp stored False;
  105.     property TextBackgroundColor: TColor index 4 read GetTColorProp write SetTColorProp stored False;
  106.     property Visible: WordBool index 5 read GetWordBoolProp write SetWordBoolProp stored False;
  107.   end;
  108.  
  109. procedure Register;
  110.  
  111. implementation
  112.  
  113. uses ComObj;
  114.  
  115. procedure TXDesktop.InitControlData;
  116. const
  117.   CTFontIDs: array [0..0] of Integer = (
  118.     $00000001);
  119.   CControlData: TControlData = (
  120.     ClassID: '{1E5161AE-D086-11D1-8CDD-E61AF2D4AD0C}';
  121.     EventIID: '';
  122.     EventCount: 0;
  123.     EventDispIDs: nil;
  124.     LicenseKey: nil;
  125.     Flags: $00000000;
  126.     Version: 300;
  127.     FontCount: 1;
  128.     FontIDs: @CTFontIDs);
  129. begin
  130.   ControlData := @CControlData;
  131. end;
  132.  
  133. procedure TXDesktop.CreateControl;
  134.  
  135.   procedure DoCreate;
  136.   begin
  137.     FIntf := IUnknown(OleObject) as IXDesktop;
  138.   end;
  139.  
  140. begin
  141.   if FIntf = nil then DoCreate;
  142. end;
  143.  
  144. function TXDesktop.GetControlInterface: IXDesktop;
  145. begin
  146.   CreateControl;
  147.   Result := FIntf;
  148. end;
  149.  
  150. function TXDesktop.GetTOleEnumProp(Index: Integer): TOleEnum;
  151. begin
  152.   Result := GetIntegerProp(Index);
  153. end;
  154.  
  155. procedure TXDesktop.SetTOleEnumProp(Index: Integer; Value: TOleEnum);
  156. begin
  157.   SetIntegerProp(Index, Value);
  158. end;
  159.  
  160. procedure TXDesktop.AboutBox;
  161. begin
  162.   CreateControl;
  163.   FIntf.AboutBox;
  164. end;
  165.  
  166.  
  167. procedure Register;
  168. begin
  169.   RegisterComponents('ActiveX', [TXDesktop]);
  170. end;
  171.  
  172. end.
  173.